#include "mainwindow.h"

#include "Tools.h"
#include "rest.h"
#include <QApplication>

/**
 * @brief qMain
 * @param argc
 * @param argv
 * @return
 * @details 测试网站  https://jsonplaceholder.typicode.com/guide/
 */
int main(int argc, char* argv[])
{
#if 1
    QApplication a(argc, argv);
    MainWindow w;
    w.show();
    return a.exec();
#else
    QApplication a(argc, argv);
    QWidget w;
    w.show ();

    REST *rest = new REST(&w);
    QFile file("jsons/RESTJson");
    if (file.open(QFile::ReadOnly)) {
        rest->setRESTJson(file.readAll());
        file.close();
    }

    rest->start ();
    QObject::connect (rest,&REST::RESTReply,[](const QByteArray ba){
        qout << ba;
    });

    QTimer::singleShot (6000,[rest]{
        rest->stop ();
    });

    return a.exec();
#endif
}
